package work20241210.a_String;

import java.util.Arrays;

/**
 * @author zdl
 * @date 2024/12/10
 */
public class StringCharAt {
    public static void main(String[] args) {
        String str = "java";
        System.out.println(str.charAt(2)); //查找下标为2的字符
        char[] charArray = str.toCharArray();
        System.out.println(Arrays.toString(charArray));

        //charAt()
        for (int i = 0; i < charArray.length; i++) {
            if (i == 2){
                System.out.println(charArray[i]);
            }
        }
    }
}
